package cfca.paperless.client.servlet._8_local;

import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.io.FileUtils;

import cfca.paperless.client.util.IoUtil;
import cfca.paperless.client.util.PdfOperateUtil;

/**
 * @Description 合并PDF列表接口，使用示例。
 * 
 * @Author dell
 * @Date 2016-5-23
 * @CodeReviewer TODO
 */
public class AutoConcatPdfListLocalTest01 {

    public static void main(String[] args) throws Exception {
        try {
            long timeStart = System.currentTimeMillis();// 开始时间


            String pdfStr1 = "./TestData/output/compoundSealAutoPdf.pdf";


            byte[] pdf1 = FileUtils.readFileToByteArray(new File(pdfStr1));
            byte[] pdf2 = FileUtils.readFileToByteArray(new File(pdfStr1));
            List<byte[]> pdfList = new ArrayList<byte[]>();
            pdfList.add(pdf1);
            pdfList.add(pdf2);
            
            byte[] pdf = PdfOperateUtil.autoConcatPdfList(pdfList, true);

            System.out.println("OK:autoConcatPdfList");
            IoUtil.write("./TestData/output/autoConcatPdfList-local.pdf", pdf);


            long timeEnd = System.currentTimeMillis();// 结束时间
            System.out.println("########## autoConcatPdfList" + " end,time:" + (timeEnd - timeStart) + "##########");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
